package com.linkage.educloud.ah.bean;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Mr'Tang on 2018/12/20.
 */

public class EduResBean {
    private String resname;// 资源名称
    private long resid;// 资源id
    private String resurl;// 资源详情地址
    private String resicon;// 资源展示图地址
    private String speaker;// 主讲人
    private int price;// 资源价格最终实际价
    private String sign;//标签
    private int readNum;//阅读人数
    private String combo;//资源属于的模块
    private String year;//版本年份

    public static List<EduResBean> parseFromJson(JSONArray array) {
        List<EduResBean> searchRes_list = new ArrayList<EduResBean>();
        for (int i = 0; i < array.length(); i++) {
            EduResBean child = new EduResBean();
            JSONObject obj = array.optJSONObject(i);
            child.setResname(obj.optString("resname"));
            child.setResid(obj.optLong("resid"));
            child.setResurl(obj.optString("resurl"));
            child.setResicon(obj.optString("resicon"));
            child.setSpeaker(obj.optString("speaker"));
            child.setPrice(obj.optInt("price"));
            child.setCombo(obj.optString("combo"));
            child.setYear(obj.optString("year"));
            searchRes_list.add(child);
        }
        return searchRes_list;
    }

    public String getCombo() {
        return combo;
    }

    public void setCombo(String combo) {
        this.combo = combo;
    }

    public String getSign() {
        return sign;
    }

    public void setSign(String sign) {
        this.sign = sign;
    }

    public int getReadNum() {
        return readNum;
    }

    public void setReadNum(int readNum) {
        this.readNum = readNum;
    }

    public String getResname() {
        return resname;
    }

    public void setResname(String resname) {
        this.resname = resname;
    }

    public long getResid() {
        return resid;
    }

    public void setResid(long resid) {
        this.resid = resid;
    }

    public String getResurl() {
        return resurl;
    }

    public void setResurl(String resurl) {
        this.resurl = resurl;
    }

    public String getResicon() {
        return resicon;
    }

    public void setResicon(String resicon) {
        this.resicon = resicon;
    }

    public String getSpeaker() {
        return speaker;
    }

    public void setSpeaker(String speaker) {
        this.speaker = speaker;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    public String getYear() {
        return year;
    }

    public void setYear(String year) {
        this.year = year;
    }
}
